package com.dyrs.delaytaskservice.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.concurrent.TimeUnit;

import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

/**
 * Description: 任务
 * Version: 1.0
 * Create Date Time: 2020-10-27
 * Update Date Time:
 * Author: 孙付存
 * E-Mail: 874878489@qq.com
 * @see
 */
@Controller
@RequestMapping("task")
public class TaskController {

    @Autowired
    StringRedisTemplate stringRedisTemplate;

    @RequestMapping(value = "/get", method = GET)
    @ResponseBody
    public String get() {

        return "get";
    }

    @RequestMapping(value = "/add", method = GET)
    @ResponseBody
    public String add() {

        stringRedisTemplate.opsForValue().set("redistest", "100", 60, TimeUnit.SECONDS);

        return "add";
    }

}
